<?php
define('ROOT',dirname($_SERVER['SCRIPT_FILENAME']));
require_once ROOT.'/core/yckit.config.php';
require_once ROOT.'/core/yckit.function.php';
require_once ROOT.'/core/yckit.version.php';
import('db');
$db=new db('localhost','497189','uhuangse.com','497189',false);
#数据库创建表
echo ROOT;
echo '<br/>';
$start_time=microtime(true);
$dir = ROOT . '/sql/';
$result=scandir($dir);
foreach($result as $value){
	if($value != '.' && $value !='..'){
		if(strrchr($value,".") == ".txt"){
			$handle = fopen($dir.$value, "rb");//读取二进制文件时，需要将第二个参数设置成'rb'
			$sql = fread($handle, filesize ($dir.$value));
			fclose($handle);
			// echo 'exec ' . $dir.$value . '<br/>';
			$segment = explode(";\r\n\r\n",$sql);
			foreach($segment as & $statement){
				$r = $db->query($statement);
				echo $r;
			}
		}
	}
}
$end_time=microtime(true);
$time=$end_time-$start_time;
echo '<br/>' . $time;
?>

